import App from './App.vue'
import plugins from './plugins'
import uviewPlus from 'uview-plus'
import store from '@/store'
import './permission';
import directive from './directive' // directive

import {
	createSSRApp
} from 'vue'
import {
	handleTree,
	parseTime,
	addDateRange
} from '@/utils/ruoyi'
import {
	useDict
} from '@/utils/dict'
import ImageUpload from "@/components/image-upload/index.vue";
import Album from "@/components/album/index.vue";

export function createApp() {
	const app = createSSRApp(App)

	app.config.globalProperties.useDict = useDict;
	app.config.globalProperties.parseTime = parseTime;
	app.config.globalProperties.handleTree = handleTree;
	app.config.globalProperties.addDateRange = addDateRange;
	app.config.globalProperties.globalData = {};

	app.use(uviewPlus)
	app.use(plugins)
	app.use(store)

	app.component('ImageUpload', ImageUpload)
	app.component('Album', Album)

	directive(app)

	return {
		app
	}
}
